package app.common.utils.cjt.ao;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.CollectionUtils;

import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;

/**
 * 其他入库单创建
 * @author feizns
 * @since 2023/3/31
 */
@NoArgsConstructor
@Data
public class OtherReceiveCreateAo {

    /**
     * dto
     */
    private Dto dto;

    /**
     * Dto
     */
    @NoArgsConstructor
    @Data
    public static class Dto {
        /**
         * externalCode
         */
        private String externalCode;
        /**
         * code
         */
        private String code;
        /**
         * voucherType
         */
        private VoucherType voucherType;

        /**
         * 是否是修改代码
         */
        private Boolean isModifiedCode = Boolean.TRUE;

        /**
         * partner
         */
        private Partner partner;
        /**
         * voucherDate
         */
        private String voucherDate;
        /**
         * busiType
         */
        private BusiType busiType;
        /**
         * warehouse
         */
        private Warehouse warehouse;
        /**
         * memo
         */
        private String memo;

        /**
         * rd风格
         */
        private RdStyle rdStyle;

        /**
         * rd风格
         * @author feizns
         * @since 2023/04/06
         */
        @Data
        @NoArgsConstructor
        @AllArgsConstructor
        public static class RdStyle {
            private String code;
        }

        /**
         * rDRecordDetails
         */
        private RDRecordDetails rDRecordDetailsObj;
        /**
         * rDRecordDetails
         */
        private List<RDRecordDetails> rDRecordDetails;

        public List<RDRecordDetails> getRDRecordDetails() {
            return CollectionUtils.isEmpty(rDRecordDetails) ? Collections.singletonList(rDRecordDetailsObj) : rDRecordDetails;
        }

        /**
         * VoucherType
         */
        @NoArgsConstructor
        @Data
        @AllArgsConstructor
        public static class VoucherType {
            /**
             * code
             */
            private String code;
        }

        /**
         * Partner
         */
        @NoArgsConstructor
        @Data
        public static class Partner {
            /**
             * code
             */
            private String code;
        }

        /**
         * BusiType
         */
        @NoArgsConstructor
        @Data
        @AllArgsConstructor
        public static class BusiType {
            /**
             * code
             */
            private String code;
        }

        /**
         * Warehouse
         */
        @NoArgsConstructor
        @Data
        @AllArgsConstructor
        public static class Warehouse {
            /**
             * code
             */
            private String code;
        }

        /**
         * RDRecordDetails
         */
        @NoArgsConstructor
        @Data
        public static class RDRecordDetails {
            /**
             * code
             */
            private String code;
            /**
             * inventory
             */
            private Inventory inventory;
            /**
             * invLocation
             */
            private InvLocation invLocation;
            /**
             * baseQuantity
             */
            private BigDecimal baseQuantity;
            /**
             * amount
             */
            private BigDecimal amount;
            /**
             * price
             */
            private BigDecimal price;
            /**
             * dynamicPropertyKeys
             */
            private List<String> dynamicPropertyKeys;
            /**
             * dynamicPropertyValues
             */
            private List<String> dynamicPropertyValues;

            /**
             * Inventory
             */
            @NoArgsConstructor
            @Data
            @AllArgsConstructor
            public static class Inventory {
                /**
                 * code
                 */
                private String code;
            }

            /**
             * InvLocation
             */
            @NoArgsConstructor
            @Data
            @AllArgsConstructor
            public static class InvLocation {
                /**
                 * code
                 */
                private String code;
            }
        }
    }

}
